package cn.cas.mango.service;

import cn.cas.mango.dto.Message;
import cn.cas.mango.dto.param.BaseParam;

import cn.cas.mango.dto.param.QueryParam;
import cn.cas.mango.util.TimeUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

@Slf4j
abstract public class BaseService {

  abstract public Message run(BaseParam baseParam);
  public Message exec(BaseParam baseParam) {
    TimeUtil timeUtil = new TimeUtil();
    try {
      timeUtil.setStart();
      return run(baseParam);
    } catch (Exception e) {
      log.error("error: {}", e.getMessage(), e);;
      return Message.unSuccess("正在查询，请稍候。。。");
    } finally {
      log.info("getDetail cost: {}s", timeUtil.getCost());
    }
  }
}
